<?php

class Maven_ManageCatalogSpr_Model_Observer
{
	/*
	 * Execute Cron job
	 * Process The Schedules.
	 *
	 */
	public function checkIsRunning($jobCode)
	{
		return false;
	}
    	public function processStock()
	{
		if(!$this->checkIsRunning('managecatalogspr_stock')) {
			$obj = Mage::getModel('managecatalogspr/import');
			$msg = $obj->runStock();
		}else {
			print "Stock Update is running";
			return;
		}
	}
	public function processPrice()
	{ 
		if(!$this->checkIsRunning('managecatalogspr_price')) {
			$file=Mage::getBaseDir()."/shell/import_product.php";
			if(!is_dir($file)){
				system("php ".$file." --start");
			}else{
				print "File does not exit!!";
				return;
			}
		}else {
			print "Price Update is running";
			return;
		}
	}
	public function processStock()
	{
		if(!$this->checkIsRunning('managecatalogspr_SprStock')) {
			$obj = Mage::getModel('managecatalogspr/import');
			$msg = $obj->sprStockUpdate();
		}else {
			print "Stock Update is running";
			return;
		}
	}
	
}
